package material

import (
	"context"
	"github.com/streadway/amqp"
	"github.com/zeromicro/go-zero/core/logx"
	"go-zero-demo/app/datacenter/mq/internal/svc"
)

type ConsumeTest2 struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewConsumeTest2(ctx context.Context, svcCtx *svc.ServiceContext) *ConsumeTest2 {
	return &ConsumeTest2{
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ConsumeTest2) Handle(ctx context.Context, d amqp.Delivery) {
	l.Consume(string(d.Body))
}

func (l *ConsumeTest2) Consume(val string) error {
	logx.Infof("msg val = %s", val)

	return nil
}
